
const navigationBar = {
  shiji: {
    frontColor: '#ffffff', // 导航栏文字设置
    backgroundColor: '#2B3757' // 导航栏背景色设置
  },
  black: {
    frontColor: '#ffffff',
    backgroundColor: '#000000'
  }
}

const tabBar = {
  shiji: {
    color: '#9299A7',
    selectedColor: '#ffffff',
    backgroundColor: '#2B3757'
  },
  black: {
    color: '#9299A7',
    selectedColor: '#ffffff',
    backgroundColor: '#000000'
  }
}


import { defineStore } from 'pinia'

export  default defineStore('module-theme', {
  state: () => {
    return {
      theme: uni.getStorageSync('theme')? uni.getStorageSync('theme') : 'shiji'
    }
  },
  actions: {
    setTheme(theme: string ) {
      this.theme = theme
      uni.setTabBarStyle(tabBar[ this.theme as keyof typeof tabBar])
      uni.setNavigationBarColor(navigationBar[this.theme as keyof typeof navigationBar])
      uni.setStorageSync('theme', theme)
    }
  },
  getters:{
    getTheme() :string{
      return this.theme
    },
    navigationBar() :any{
      return navigationBar[this.theme as keyof typeof navigationBar]
    },
    tabBar() :any{
      return tabBar[ this.theme as keyof typeof tabBar]
    }

  }
})

